package KFMmovie;

import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Objects;

public class Movie {
    private String name ;
    private double pricce;
    private String director;
    private int date;

    private int count;

    public Movie(Movie movie, int ticket){
        this(movie.getName(),movie.getPricce(),movie.getDirector(),movie.getDate(),movie.getCount());
        this.count =ticket;
    }

    public Movie(String name, double pricce, String director, int date,int count) {
        this.name = name;
        this.pricce = pricce;
        this.director = director;
        this.date = date;
        this.count = count;
    }


    public String getName() {
        return name;
    }

    public double getPricce() {
        return pricce;
    }

    public String getDirector() {
        return director;
    }

    public int getDate() {
        return date;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setPricce(double pricce) {
        this.pricce = pricce;
    }

    public void setDirector(String director) {
        this.director = director;
    }

    public void setDate(int date) {
        this.date = date;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    @Override
    public String toString() {
        return "Movie{" +
                "电影名称：" + name +
                "，电影价格：" + pricce +
                "，导演：" + director +
                "，上映时间：" + date +
                "，票数：" + count +
                '}';
    }

    public boolean equals(Object obj){
        if (this == obj){
            return true;
        }
        if (obj instanceof Movie movie){
            if (Objects.equals(this.director,movie.getDirector())
                && this.date == movie.getDate()
                && this.pricce == movie.getPricce()){
                return true;
            }
        }
        return false;
    }
}
